package cz.muni.fi.pa165.sme.web.pages.sportActivityRecord;

import cz.muni.fi.pa165.sme.web.fo.SportActivityRecordFO;
import cz.muni.fi.pa165.sme.web.pages.TemplatePage;
import cz.muni.fi.pa165.sme.web.panels.sportActivityRecord.RecordForm;
import org.apache.wicket.authorization.Action;
import org.apache.wicket.authroles.authorization.strategies.role.Roles;
import org.apache.wicket.authroles.authorization.strategies.role.annotations.AuthorizeAction;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.model.ResourceModel;

/**
 * @author jirankova
 */
@AuthorizeAction(action = Action.RENDER, roles = { Roles.ADMIN, Roles.USER})
public class RecordEditPage extends TemplatePage {
	public RecordEditPage(final SportActivityRecordFO sportActivityRecordFO) {
		add(new Label("title", new ResourceModel("title")));

		final CompoundPropertyModel<SportActivityRecordFO>
				recordModel = new CompoundPropertyModel<SportActivityRecordFO>(new LoadableDetachableModel<SportActivityRecordFO>() {
			@Override
			protected SportActivityRecordFO load() {
				return sportActivityRecordFO;
			}
		});

		add(new RecordForm("form", recordModel));
	}
}
